<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>编辑读者信息</title>
  <style>
    body {
      font-family: 'Arial', sans-serif;
      background-color: #f7f7f7;
      margin: 0;
      padding: 0;
    }

    .container {
      max-width: 600px;
      margin: 50px auto;
      background-color: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    h2 {
      text-align: center;
      color: #333;
      margin-bottom: 20px;
    }

    form {
      display: flex;
      flex-direction: column;
      gap: 15px;
    }

    label {
      font-weight: bold;
      color: #333;
    }

    input[type="text"], input[type="submit"] {
      padding: 10px;
      font-size: 16px;
      border: 1px solid #ccc;
      border-radius: 4px;
      width: 100%;
      box-sizing: border-box;
    }

    input[type="submit"] {
      background-color: #4CAF50;
      color: white;
      font-weight: bold;
      cursor: pointer;
      transition: background-color 0.3s ease;
    }

    input[type="submit"]:hover {
      background-color: #45a049;
    }

    .error {
      color: red;
      text-align: center;
      margin-top: 10px;
    }
  </style>
</head>
<body>
<div class="container">
  <h2>编辑读者信息</h2>
  <form action="ReaderEdit" method="post">
    <!-- 隐藏字段，传递读者 ID -->
    <input type="hidden" name="id" value="${reader.id}" />
    <div>
      <label for="name">读者姓名:</label>
      <input type="text" id="name" name="name" value="${reader.name}" placeholder="请输入读者姓名" required />
    </div>
    <div>
      <label for="pd">读者编号:</label>
      <input type="text" id="pd" name="pd" value="${reader.pd}" placeholder="请输入读者编号" required />
    </div>
    <div>
      <input type="submit" value="保存" />
    </div>
  </form>

  <!-- 如果有错误，显示错误信息 -->
  <c:if test="${not empty error}">
    <p class="error">${error}</p>
  </c:if>
</div>
</body>
</html>
